PM_FUNC_NORM_ATTRIB SKILL:SkillDrillPeck( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Drill Peck", .Type = TYPE_FLYING, .callTypes = CALL_BIND_DOWN, .PP = 20, .Charges = 10, .DelayTime = 5.0 );
		case CALL_HELP:     return SkillHelp( "Rapidly fires short range damage." );
		case CALL_BIND_DOWN:
		{
			SoundHit( id );

			EntitySkillCreate( .iPlayer = id,
								.iProperty = SEP_TOUCH|SEP_DAMAGE|SEP_KILL,
								.fKillTime = 0.5,
								.iDamage = StatClamp( id, STAT_ATTACK, 5, 10 ),
								.iMoveType = MOVETYPE_FLY,
								.iSolidType = SOLID_TRIGGER,
								.iModel = MODEL_ROCKET,
								.iSound = SOUND_HIT,
								.bPlayerOrigin = true,
								.bPlayerAngles = true,
								.vMins = Vector:{-5.0,-5.0,-5.0},
								.vMaxs = Vector:{5.0,5.0,5.0},
								.iAimVelocity = StatClamp( id, STAT_SPEED, 300, 700 )
							);

			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillFly( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Fly", .Type = TYPE_FLYING, .callTypes = CALL_BIND_DOWN, .PP = 15, .Charges = 10, .DelayTime = 5.0 );
		case CALL_HELP:     return SkillHelp( "Gives a boost into the air." );
		case CALL_BIND_DOWN:
		{
			new Int:iJumpVel = StatClamp( id, STAT_SPECIAL, 50, 100 );

			new Vector:vVelocity[3];
			EntityGetVelocity( id, vVelocity );

			if ( vVelocity[2] < 1.5 * iJumpVel )
				vVelocity[2] += float( iJumpVel );

			if( pev( id, pev_button ) & IN_FORWARD && sqroot( floatround( vVelocity[0] * vVelocity[0] + vVelocity[1] * vVelocity[1] ) ) < iJumpVel )
			{
				new Vector:vVec[3];
				velocity_by_aim( id, iJumpVel, vVec );
				vVelocity[0] += vVec[0];
				vVelocity[1] += vVec[1];
			}

			SoundEmit( id, SOUND_JUMPLAND );
			EntitySetVelocity( id, vVelocity );
			set_pev( id, pev_gaitsequence, 6 );

			return SKILL_USED_PAUSE;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillMirrorMove( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Mirror Move", .Type = TYPE_FLYING, .callTypes = CALL_TAKE_POKEDAMAGE, .PP = 20, .Charges = 5, .DelayTime = 15.0 );
		case CALL_HELP:     return SkillHelp( "Mirrors damage when hit by a skill." );
		case CALL_TAKE_POKEDAMAGE:
		{
			SkillDamage( .victim = g_iAttacker,
						.attacker = id,
						.damage = floatround( g_fDamage )
						);

			SoundEmit( id, SOUND_JUMPLAND );

			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillPeck( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Peck", .Type = TYPE_FLYING, .callTypes = CALL_BIND_DOWN, .PP = 35, .Charges = 5, .DelayTime = 5.0 );
		case CALL_HELP:     return SkillHelp( "Fires short range damage." );
		case CALL_BIND_DOWN:
		{
			SoundHit( id );

			EntitySkillCreate( .iPlayer = id,
								.iProperty = SEP_TOUCH|SEP_DAMAGE|SEP_KILL,
								.fKillTime = 0.5,
								.iDamage = StatClamp( id, STAT_ATTACK, 5, 10 ),
								.iMoveType = MOVETYPE_FLY,
								.iSolidType = SOLID_TRIGGER,
								.iModel = MODEL_ROCKET,
								.iSound = SOUND_HIT,
								.bPlayerOrigin = true,
								.bPlayerAngles = true,
								.vMins = Vector:{-5.0,-5.0,-5.0},
								.vMaxs = Vector:{5.0,5.0,5.0},
								.iAimVelocity = StatClamp( id, STAT_SPEED, 300, 700 )
							);

			return SKILL_USED_PAUSE;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillSkyAttack( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Sky Attack", .Type = TYPE_FLYING, .callTypes = CALL_BIND_DOWN|CALL_CUSTOM, .PP = 5, .Charges = 1, .DelayTime = 5.0 );
		case CALL_HELP:     return SkillHelp( "Fly into the air and attack down onto someone." );
		case CALL_BIND_DOWN:
		{
			if ( SkillCheck( id, CHECK_BOMB, "Sky Attack" ) )
				return SKILL_DENY;

			new CsTeams:iTeam = cs_get_user_team( id );

			new Vector:vOrigin[3], Vector:vEnemyOrigin[3];
			EntityGetOrigin( id, vOrigin );

			new Float:fClosestDist = StatClamp( id, STAT_SPECIAL, 500.0, 750.0 );
			new Int:iClosestEnemy, Float:fTempDist;

			LoopThroughPlayersFlags( iPlayer, PLAYER_FLAGS_ALIVE )
			{
				if ( iTeam == cs_get_user_team( iPlayer ) )
					continue;

				EntityGetOrigin( iPlayer, vEnemyOrigin );

				//Make sure the enemy is not high in the air (sky attack) or low in the ground (maybe dig or something)
				if ( floatabs( vOrigin[2] - vEnemyOrigin[2] ) > 1000.0 )
					continue;

				fTempDist = get_distance_f( vOrigin, vEnemyOrigin );
				if ( fTempDist < fClosestDist || !iClosestEnemy )
				{
					iClosestEnemy = iPlayer;
					fClosestDist = fTempDist;
				}
			}

			if ( iClosestEnemy )
			{
				SoundEmit( id, SOUND_JUMPLAND );

				vOrigin[2] += 2000.0;
				EntitySetOrigin( id, vOrigin );

				EntityGetOrigin( iClosestEnemy, gSkillVector[ id ] );

				new Float:fDelayTime = StatClamp( id, STAT_SPEED, 5.0, 2.5 );
				SkillDelayCustomCall( id, fDelayTime );

				return SKILL_WAIT;
			}
			else
			{
				client_print( id, print_center, "No player close enough" );
				return SKILL_DENY;
			}
		}
		case CALL_CUSTOM:
		{
			//Make sure the vector didn't get reset from a new round
			if ( gSkillVector[ id ][ 0 ] || gSkillVector[ id ][ 1 ] || gSkillVector[ id ][ 2 ] )
			{
				EntitySetOrigin( id, gSkillVector[ id ] );

				SoundEmit( id, SOUND_BIGGUN );

				new Coord:cOrigin[3];
				VectorToCoord( gSkillVector[ id ], cOrigin );

				new Int:iDamage = StatClamp( id, STAT_ATTACK, 50, 75 );
				new Float:fRadius = StatClamp( id, STAT_SPECIAL, 100.0, 500.0 );

				SkillAoEDamage( .attacker = id,
								.cOrigin = cOrigin,
								.fRadius = fRadius,
								.iMaxDamage = iDamage,
								.flags = AOE_IGNORE_ATTACKER
								);

				EffectBlastCircle( .cOrigin = cOrigin,
									.iSprite = SPRITE_SHOCKWAVE,
									.iRadius = floatround( fRadius ),
									.fLife = 1.0,
									.iWidth = iDamage / 2,
									.iNoise = 0,
									.iRed = 255,
									.iGreen = 255,
									.iBlue = 255,
									.iAlpha = 255
								);

				UnStuck( id );

				return SKILL_USED;
			}
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillWingAttack( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Wing Attack", .Type = TYPE_FLYING, .callTypes = CALL_BIND_DOWN, .PP = 35, .Charges = 1, .DelayTime = 1.0 );
		case CALL_HELP:     return SkillHelp( "Wings attack from your sides" );
		case CALL_BIND_DOWN:
		{
			new Vector:vVelocity[3], Vector:vOriginOffset[2][3];
			velocity_by_aim( id, 20, vVelocity );

			vOriginOffset[0][0] = vVelocity[1];
			vOriginOffset[0][1] = -vVelocity[0];
			vOriginOffset[1][0] = -vVelocity[1];
			vOriginOffset[1][1] = vVelocity[0];

			new Int:iDamage = StatClamp( id, STAT_ATTACK, 30, 70 );
			new Int:iAimVelocity = StatClamp( id, STAT_SPEED, 300, 700 );

			new Float:fKillTime = StatClamp( id, STAT_SPECIAL, 0.5, 1.5 );

			new Int:iEntity;
			for ( new i; i < 2; i++ )
			{
				iEntity = EntitySkillCreate( .iPlayer = id,
									.iProperty = SEP_TOUCH|SEP_DAMAGE|SEP_KILL,
									.fKillTime = fKillTime,
									.iDamage = iDamage,
									.iMoveType = MOVETYPE_FLY,
									.iSolidType = SOLID_TRIGGER,
									.iModel = MODEL_ROCKET,
									.iSound = SOUND_HIT,
									.iSprite = SPRITE_BUBBLE,
									.bPlayerOrigin = true,
									.vOrigin = vOriginOffset[ i ],
									.bPlayerAngles = true,
									.vMins = Vector:{-5.0,-5.0,-5.0},
									.vMaxs = Vector:{5.0,5.0,5.0},
									.iAimVelocity = iAimVelocity
								);

				EffectBeamEnts( .iPlayer = 0,
								.iStartEnt = id,
								.iEndEnt = iEntity,
								.iSprite = SPRITE_ZBEAM6,
								.iStartFrame = 0,
								.iFrameRate = 10,
								.fLife = fKillTime,
								.iLineWidth = iDamage,
								.iNoiseAmp = 5,
								.iRed = 255,
								.iGreen = 255,
								.iBlue = 255,
								.iAlpha = 255,
								.iScrollSpeed = 10
							);
			}

			SoundEmit( id, SOUND_JUMPLAND );

			return SKILL_USED;
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillWrap( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Wrap", .Type = TYPE_NORMAL, .callTypes = CALL_GIVE_DAMAGE, .PP = 20, .Charges = 1, .DelayTime = 5.0 );
		case CALL_HELP:     return SkillHelp( "Chance to paralyze enemies you attack." );
		case CALL_GIVE_DAMAGE:
		{
			if ( StatChance( id, STAT_ATTACK, 33, 66 ) )
			{
				new Int:iParalysisTime = StatClamp( id, STAT_SPECIAL, 1, 5 );
				StatusApply( g_iVictim, id, STATUS_PARALYZE, iParalysisTime );

				SoundHit( id );

				return SKILL_USED;
			}
		}
	}
	return SKILL_READY;
}



